<?php
namespace app\daili\controller;
use think\Db;
class Baotian extends Base
{
    public function index()
    {
        $dailiuid = session('dailiuid');
        $user = Db::name("member")->where(['id' => $dailiuid])->find();
        $baotiankaiguan = $user['baotiankaiguan'];
        $baotianjiner = $user['baotianjiner'];
        
        if (input("post."))
        {
            $baotiankaiguan = input("post.baotiankaiguan");
            $baotianjiner = input("post.baotianjiner");
            Db::name("member")->where(['id' => $dailiuid])->update(['baotiankaiguan' => $baotiankaiguan, 'baotianjiner' => $baotianjiner]);

            return ['code' => 1, 'msg' => "修改成功！"];
        }

        $zhifu = Db::name("member")->where('id', $dailiuid)->find();

        $this->assign("baotiankaiguan", $baotiankaiguan);
        $this->assign("baotianjiner", $baotianjiner);
        
        return $this->fetch();
    }
}
